Emit unquoted top-level on: in compiled .lock.yml workflows#32357
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Fix quoted top-level on key in generated lock.yml
Emit unquoted top-level May 15, 2026
on: in compiled .lock.yml workflows
Contributor
There was a problem hiding this comment.
Pull request overview
Normalizes the compiled *.lock.yml workflow output to emit an unquoted top-level on: key (instead of "on":) for consistency with hand-authored GitHub Actions workflows, while intentionally leaving nested quoted keys unchanged.
Changes:
- Adds
UnquoteYAMLTopLevelKeyhelper inpkg/workflow/yaml.goand invokes it ingenerateWorkflowBodyafter existing on-section transformations. - Adds focused unit tests for the helper and a regex-based assertion in
compiler_validation_test.goto guard the top-levelon:form. - Updates affected event/centralized command compile test expectations and wasm golden fixtures to the new unquoted output.
Show a summary per file
| File | Description |
|---|---|
| pkg/workflow/yaml.go | New top-level-only unquoting helper with doc comment. |
| pkg/workflow/yaml_test.go | Unit tests for UnquoteYAMLTopLevelKey covering top-level, nested, and already-unquoted cases. |
| pkg/workflow/compiler_yaml.go | Applies the new helper to the on section in workflow body generation. |
| pkg/workflow/compiler_validation_test.go | Regex assertion ensuring generated YAML has unquoted top-level on:. |
| pkg/workflow/compiler_events_test.go | Updates expected on strings to the unquoted form. |
| pkg/workflow/slash_command_centralized_compile_test.go | Updates expected substring to the unquoted form. |
| pkg/workflow/testdata/TestWasmGolden_CompileFixtures/*.golden | Golden updates to reflect unquoted on:. |
| pkg/workflow/testdata/wasm_golden/WasmBinary/*.golden | Wasm golden updates to reflect unquoted on:. |
| .github/workflows/ci-coach.lock.yml | Large lock file regeneration; still contains "on": and includes unrelated version/structure drift. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 15/15 changed files
- Comments generated: 1
Comment on lines
1
to
66
| @@ -14,7 +14,7 @@ | |||
| # \ /\ / (_) | | | | ( | | | | (_) \ V V /\__ \ | |||
| # \/ \/ \___/|_| |_|\_\|_| |_|\___/ \_/\_/ |___/ | |||
| # | |||
| # This file was automatically generated by gh-aw (v0.72.1). DO NOT EDIT. | |||
| # This file was automatically generated by gh-aw. DO NOT EDIT. | |||
| # | |||
| # To update this file, edit the corresponding .md file and run: | |||
| # gh aw compile | |||
| @@ -47,26 +47,25 @@ | |||
| # - actions/cache/save@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 | |||
| # - actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |||
| # - actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |||
| # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9 | |||
| # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |||
| # - actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 (source v9) | |||
| # - actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6.4.0 | |||
| # - actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | |||
| # - actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | |||
| # - github/gh-aw-actions/setup@v0.72.1 | |||
| # | |||
| # Container images used: | |||
| # - ghcr.io/github/gh-aw-firewall/agent:0.25.41@sha256:cb2b565d070116d4b67e355775340528b5a2c3cb18b2c9049638bcc2df681770 | |||
| # - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.41@sha256:fadd0de387209f69a9a7a1b8722bb5e7fdfb80ba9749a5c60f0e4cd7582a74d0 | |||
| # - ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.41@sha256:62171f2fa508667b8b0a9e096f826983f312e3da0ce894f80c0f83a875af60fe | |||
| # - ghcr.io/github/gh-aw-firewall/squid:0.25.41@sha256:1260445d25968dbf3ae70143964177a0e5914cf2ce07a6117f7d3caec6c3e3c4 | |||
| # - ghcr.io/github/gh-aw-mcpg:v0.3.6@sha256:2bb8eef86006a4c5963c55616a9c51c32f27bfdecb023b8aa6f91f6718d9171c | |||
| # - ghcr.io/github/gh-aw-firewall/agent:0.25.46 | |||
| # - ghcr.io/github/gh-aw-firewall/api-proxy:0.25.46 | |||
| # - ghcr.io/github/gh-aw-firewall/cli-proxy:0.25.46 | |||
| # - ghcr.io/github/gh-aw-firewall/squid:0.25.46 | |||
| # - ghcr.io/github/gh-aw-mcpg:v0.3.9@sha256:64828b42a4482f58fab16509d7f8f495a6d97c972a98a68aff20543531ac0388 | |||
| # - ghcr.io/github/github-mcp-server:v1.0.3@sha256:2ac27ef03461ef2b877031b838a7d1fd7f12b12d4ace7796d8cad91446d55959 | |||
| # - node:lts-alpine@sha256:d1b3b4da11eefd5941e7f0b9cf17783fc99d9c6fc34884a665f40a06dbdfc94f | |||
|
|
|||
| name: "CI Optimization Coach" | |||
| "on": | |||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug Fix
gh aw compilecurrently emits top-level workflow triggers as"on":, which is valid YAML but inconsistent with GitHub Actions conventions and tooling expectations. This change normalizes compiled lock files to use unquoted top-levelon:while leaving nested quoted keys untouched.What was the bug?
Generated
*.lock.ymlused"on":at the root, creating avoidable inconsistency with hand-authored workflows and editor/linter heuristics keyed onon:.How was it fixed?
"on":.on-section transformations.Scope of updates
"on":.on:output.